<?php

// src/Acme/DemoBundle/Form/Admin/UserType.php
namespace Acme\StoreBundle\Form\Admin;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class UserType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options) {
        
        $builder->add('email', 'email')
                ->add('username', 'text')
                ->add('password', 'repeated', array(
                    'type'           => 'password',
                    'invalid_message'=> 'Password does not match', 
                    'required'       => true,   
                    'first_options'  => array('label' => 'Password'),
                    'second_options' => array('label' => 'Repeat Password') 
                 ))
                ->add('save', 'submit');

    }
    
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Acme\StoreBundle\Entity\User'
        ));
    }

    public function getName()
    {
        return 'admin_user';
    }
}